// created by noellynch
// May 6, 2009

package com.sceneworker.app.undo;

import java.util.Stack;

public class SceneWorkerAppUndoManager {
	static	private		SceneWorkerAppUndoManager		mcl_inst;
	
	static	public	SceneWorkerAppUndoManager		inst() {
		if(mcl_inst == null) {
			mcl_inst = new SceneWorkerAppUndoManager();
		}
		
		return mcl_inst;
	}
	
	private		Stack<IUndoAction>		mcla_undoActions;
	
	private	SceneWorkerAppUndoManager() {
		mcla_undoActions = new Stack<IUndoAction>();
	}

	public	void	addUndoAction(IUndoAction cl_undo) {
		mcla_undoActions.push(cl_undo);
	}
	
	public	void	undo() {
		try {
			IUndoAction		lcl_undo = mcla_undoActions.pop();
			lcl_undo.undo();
		} catch (Exception e) {
		}
	}
}
